package org.bookshare.document.beans;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.benetech.event.EventListener;
import org.benetech.util.ViolationCollatingErrorHandler;

public class RTFDocumentSet extends AbstractDocumentSet<DocumentType.RTF> {

	/**
	 * Construct an RTF DocumentSet.
	 * @param String The name
	 * @param rtfFile The tmp rtfFile
	 * @param eventListener The event listener
	 * @param errorHandler The error handler
	 * @throws IOException if file access fails
	 */
	public RTFDocumentSet(final String name, final File rtfFile,
			final EventListener eventListener, final ViolationCollatingErrorHandler errorHandler)
	throws IOException
	{
    	super(rtfFile.getParentFile(), DocumentType.RTF, eventListener, errorHandler, false);
    	addFiles(DocumentComponent.RTF, rtfFile);
    	addFiles(DocumentComponent.PROPERTIES, new File(rtfFile.getParentFile().getAbsolutePath() + File.separator + name + ".properties"));
    }

	/**
	 * {@inheritDoc}
	 */
    public final String getName(){
    	final File rtf = getFile(DocumentComponent.RTF);
    	if (rtf != null) {
    		final String name = rtf.getName();
    		return name.substring(0, name.lastIndexOf("."));
    	}
    	return null;
    }

    public List<File> getOtherFiles() {
		return new ArrayList<File>();
	}

	public boolean containsFile(String file) throws IOException {
	    // TODO Auto-generated method stub
	    return false;
    }

	public boolean containsFileIgnoreCase(String file) throws IOException {
	    // TODO Auto-generated method stub
	    return false;
    }
    
    
}